package com.itedge.infrastructure.web.controller.task;

import javax.servlet.http.HttpServletRequest;

import org.springframework.ui.Model;

import com.itedge.infrastructure.web.dto.TaskAvailabilityResponse;
import com.itedge.infrastructure.web.taskhandler.TaskHandlerException;

/**
 * Interface for task controllers.
 * 
 * @author jhe
 *
 */
public interface ITaskController {
	
	/**
	 * Initializes task handler mappings.
	 */
	public void initializeMappings();
	
	/**
	 * Fills model objects and return view for task instance (active or historic).
	 * 
	 * @param id
	 * @param historyParam
	 * @param procId
	 * @param model
	 * @param request
	 * @return name of view used for task data rendering
	 */
	public String showTask(String id, Boolean historyParam, String procId,
			Model model, HttpServletRequest request) throws TaskHandlerException;
	
	/**
	 * Handles task data persisting and process interaction.
	 * 
	 * @param model
	 * @param request
	 * @return name of view used to redirect after task is saved
	 */
	public String saveTask(Model model, HttpServletRequest request) throws TaskHandlerException;

	/**
	 * Locks task data.
	 * 
	 * @param request
	 * @return task availability response
	 */
	public TaskAvailabilityResponse lockTask(HttpServletRequest request);
	
	/**
	 * Request availability of task data.
	 * 
	 * @param request
	 * @return task availability response
	 */
	public TaskAvailabilityResponse requestTaskAvailability(HttpServletRequest request);
}
